package bairui.international.service.impl;

import org.springframework.stereotype.Service;

import bairui.international.model.domain.jpa.TB_ElectronicTicketOrder;
import bairui.international.model.domain.jpa.TB_ElectronicTicketOrderVerifyRecord;
import bairui.international.model.type.Type_StateRecord;
import bairui.international.service.Service_ElectronicTicketOrderVerifyRecord;
import lombok.NonNull;

/**
 * 
 * 【(电子券单审核记录)TB_ElectronicTicketOrderVerifyRecord】服务实现
 *
 * @generated
 * 
 * @see bairui.international.model.domain.jpa.TB_ElectronicTicketOrderVerifyRecord 模型
 * @see Service_ElectronicTicketOrderVerifyRecord 服务接口
 * @see BService_ElectronicTicketOrderVerifyRecordImpl 服务实现基础
 *
 */
@Service
public class Service_ElectronicTicketOrderVerifyRecordImpl extends BService_ElectronicTicketOrderVerifyRecordImpl implements Service_ElectronicTicketOrderVerifyRecord {

	private TB_ElectronicTicketOrderVerifyRecord create(
		@NonNull TB_ElectronicTicketOrder order,
		@NonNull Type_StateRecord type,
		@NonNull String explain,
		String message
	) {
		return dao.save(new TB_ElectronicTicketOrderVerifyRecord(
				new TB_ElectronicTicketOrderVerifyRecord.MustProperties() {
					@Override public Type_StateRecord getType() {
						return type;
					}
					@Override public String getCommentate() {
						return explain;
					}
					@Override public TB_ElectronicTicketOrder getElectronicTicketOrder() {
						return order;
					}
				},
				new TB_ElectronicTicketOrderVerifyRecord.OptionalSingleProperties() {
					@Override public String getMessage() {
						return message;
					}
				}
			));
	}
	
	@Override
	public TB_ElectronicTicketOrderVerifyRecord createFlowRecord(
		TB_ElectronicTicketOrder order,
		String explain
	) {
		return create(order, Type_StateRecord.Flow, explain, null);
	}
	
	@Override
	public TB_ElectronicTicketOrderVerifyRecord createPassRecord(
		TB_ElectronicTicketOrder order,
		String explain,
		String message
	) {
		return create(order, Type_StateRecord.Pass, explain, message);
	}
	
	@Override
	public TB_ElectronicTicketOrderVerifyRecord createNoPassRecord(
		TB_ElectronicTicketOrder order,
		String explain,
		String message
	) {
		return create(order, Type_StateRecord.NoPass, explain, message);
	}
	
}
